#include <my_head.h>

int main(int argc, const char *argv[]){
    pid_t pid = fork();
    if(-1 == pid){
        ERR_LOG("fork error");
    }else if(0 < pid){
        sleep(1); // 让子进程先执行 
        printf("我是父进程 pid = [%d]  ppid = [%d] childpid = [%d]\n", 
            getpid(), getppid(), pid);
    }else if(0 == pid){
        printf("我是子进程 pid = [%d]  ppid = [%d]\n", getpid(), getppid());
    }
    return 0;
}